﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;

using NRadioTray.Interface;

namespace NRadioTray.App
{
    /// <summary>
    /// Class <see cref="RadioMenuPluginsBuilder"/>.
    /// </summary>
    public static class RadioMenuPluginsBuilder
    {
        /// <summary>
        /// Generates the plugins.
        /// </summary>
        /// <param name="plugins">The plugins.</param>
        /// <returns></returns>
        public static ToolStripMenuItem[] GeneratePlugins(IList<IPlugin> plugins)
        {
            List<ToolStripMenuItem> items = new List<ToolStripMenuItem>();

            foreach (var plugin in plugins)
            {
                var menuItem = new ToolStripMenuItem { Text = plugin.Name };
                menuItem.Tag = plugin.Handler;
                items.Add(menuItem);
            }

            return items.ToArray();
        }
    }
}